package com.hos.punchtheclocksystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hos.punchtheclocksystem.pojo.Card;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: ycc
 * @Date: 2021/9/3 18:50
 */
@Mapper
public interface MyMapper extends BaseMapper<Card> {

    @Select("select * from card where worker_id = #{worker_id} LIMIT 1")
    public Card oldOrYesterday(Integer worker_id);


    @Select("select * from card where worker_id = #{worker_id} order by submit_day desc")
    public List<Card> selectYourselfProceedingByDocId(Integer worker_id);

    @Select("select * from card")
    public List<Card> selectAll();

    public Integer delete(Integer[] ids);





    @Delete("delete from card where to_days(submit_day) = to_days(now()) and worker_id = #{workerid}")
    public int deleteCardByWorkerIdToday(Integer workerid);





    @Select("select * from card where to_days(submit_day) = to_days(now()) and worker_id = #{worker_id}")
    public Card selectCardToday(Integer worker_id);



}
